import { createStore } from 'vuex'

export default createStore({
  state: {
    clickCount: 0, // 初始化点击次数为 0
  },
  getters: {

    getClickCount: state => state.clickCount,

  },
  mutations: {

    INCREMENT_CLICK_COUNT(state) {
      state.clickCount++;
    },
    RESET_CLICK_COUNT(state) {
      state.clickCount = 0;
    }

  },
  actions: {

    incrementClickCount({ commit }) {
      commit('INCREMENT_CLICK_COUNT');
    },
    resetClickCount({ commit }) {
      commit('RESET_CLICK_COUNT');
    }

  },
  modules: {
  }
})
